package com.lksy.web.service.student;

import java.sql.SQLException;
import java.util.List;

import org.springframework.stereotype.Service;

import com.lksy.web.dao.student.StudentDao;
import com.lksy.web.model.Student;

@Service
public class StudentService {

	public List<Student> list() {
		try {
			return StudentDao.getInstance().list();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	public boolean save(Student student) {
		try {
			return StudentDao.getInstance().save(student);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}
	
	public boolean update(Student student) {
		try {
			return StudentDao.getInstance().update(student);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}
	
	public Student findStudentBySearchId(Integer id) {
		try {
			return StudentDao.getInstance().findStudentBySearchId(id);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	public boolean deleteStudent(Integer id) {
		try {
			return StudentDao.getInstance().deleteStudent(id);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}
}
